/**
 * 
 */
package view;

import java.awt.event.KeyEvent;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

/**
 * This class loads the {@link JMenuBar} for the Compose New Mail Window.
 * 
 * @author Farzana Alam (farzana22@gmail.com)
 * @since May 2013
 *
 */
@SuppressWarnings("serial")
public class ComposeMailMainMenu extends JMenuBar {
	
	/**
	 * {@link JMenu} instances.
	 */
	private JMenu fileMenu, editMenu;
	
	/**
	 * {@link JMenuItem} instances of File {@link JMenu}.
	 */
	private JMenuItem newMessage, saveMail, sendMailNow, sendMailLater, closeWindow;
	
	/**
	 * {@link JMenuItem} instances for the Edit {@link JMenu}.
	 */
	private JMenuItem _copy, _cut, _paste, _selectAll;
	
	/**
	 * Constructs a {@link ComposeMailMainMenu} instance.
	 */
	public ComposeMailMainMenu() {
		loadFileMenu();
		loadEditMenu();
		
		this.add(fileMenu);
		this.add(editMenu);		
	}
	
	/**
	 * Facade for loading all the {@link JMenuItem}s for Edit {@link JMenu}.
	 */
	private void loadEditMenu() {
		/*
		 * Loading Edit Menu
		 */
		
		editMenu = new JMenu("Edit");
		editMenu.setMnemonic(KeyEvent.VK_E);
		
		// Copy menu item
		_copy = new JMenuItem("Copy");
		_copy.setMnemonic(KeyEvent.VK_C);
		editMenu.add(_copy);
		
		// Cut menu item
		_cut = new JMenuItem("Cut");
		_cut.setMnemonic(KeyEvent.VK_T);
		editMenu.add(_cut);
		
		// Paste menu item
		_paste = new JMenuItem("Paste");
		_paste.setMnemonic(KeyEvent.VK_P);
		editMenu.add(_paste);
		editMenu.addSeparator();
		
		// Select All menu item
		_selectAll = new JMenuItem("Select All");
		_selectAll.setMnemonic(KeyEvent.VK_A);
		editMenu.add(_selectAll);
	}

	/**
	 * Facade for loading all the {@link JMenuItem}s for the File {@link JMenu}.
	 */
	private void loadFileMenu() {
		/*
		 * Loading File Menu
		 */
				
		fileMenu = new JMenu("File");
		fileMenu.setMnemonic(KeyEvent.VK_F);
		
		// New Message menu item
		newMessage = new JMenuItem("New Message");
		newMessage.setMnemonic(KeyEvent.VK_N);
		fileMenu.add(newMessage);
		
		// Save as Draft menu item
		saveMail = new JMenuItem("Save as Draft");
		saveMail.setMnemonic(KeyEvent.VK_V);
		fileMenu.add(saveMail);
		fileMenu.addSeparator();
		
		// Send Now menu item 
		sendMailNow = new JMenuItem("Send Now");
		sendMailNow.setMnemonic(KeyEvent.VK_S);
		fileMenu.add(sendMailNow);
		
		// Send Later menu item
		sendMailLater = new JMenuItem("Send Later");
		sendMailLater.setMnemonic(KeyEvent.VK_L);
		fileMenu.add(sendMailLater);			
		fileMenu.addSeparator();
		
		// Close menu item
		closeWindow = new JMenuItem("Close");
		closeWindow.setMnemonic(KeyEvent.VK_O);
		fileMenu.add(closeWindow);
	}

	/**
	 * Getter for newMessage
	 * @return {@link JMenuItem}
	 */
	public JMenuItem getNewMessage() {
		return newMessage;
	}

	/**
	 * Getter for saveMail.
	 * @return {@link JMenuItem}
	 */
	public JMenuItem getSaveMail() {
		return saveMail;
	}

	/**
	 * Getter for sendMailNow.
	 * @return {@link JMenuItem}
	 */
	public JMenuItem getSendMailNow() {
		return sendMailNow;
	}

	/**
	 * Getter for sendMailLater.
	 * @return {@link JMenuItem}
	 */
	public JMenuItem getSendMailLater() {
		return sendMailLater;
	}

	/**
	 * Getter for closeWindow.
	 * @return {@link JMenuItem}
	 */
	public JMenuItem getCloseWindow() {
		return closeWindow;
	}	

	/**
	 * Getter for _copy.
	 * @return {@link JMenuItem}
	 */
	public JMenuItem get_copy() {
		return _copy;
	}

	/**
	 * Getter for _cut.
	 * @return {@link JMenuItem}
	 */
	public JMenuItem get_cut() {
		return _cut;
	}

	/**
	 * Getter for _paste.
	 * @return {@link JMenuItem}
	 */
	public JMenuItem get_paste() {
		return _paste;
	}

	/**
	 * Getter for _selectall.
	 * @return {@link JMenuItem}
	 */
	public JMenuItem get_selectAll() {
		return _selectAll;
	}	
	
}
